From: Jimi Xenidis Date: Fri, 1 Sep 2006 17:14:53 +0000 (-0400) Subject: [POWERPC][XEN] Make many of the timbase routine static inline X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15658^2~86 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=429cd011b1788fd9697fe68f5c73a94e7ac6d84e;p=xen.git [POWERPC][XEN] Make many of the timbase routine static inline Signed-off-by: Jimi Xenidis Signed-off-by: Hollis Blanchard --- diff --git a/xen/arch/powerpc/time.c b/xen/arch/powerpc/time.c index 17c89f13ea..1811985199 100644 --- a/xen/arch/powerpc/time.c +++ b/xen/arch/powerpc/time.c @@ -34,40 +34,6 @@ ulong ticks_per_usec; unsigned long cpu_khz; unsigned int timebase_freq; -u64 get_timebase(void) -{ - u64 s; - -#ifdef __PPC64__ - s = mftb(); -#else - do { - unsigned up; - unsigned lo; - unsigned up2; - - up = mftbu(); - lo = mftbl(); - up2 = mftbu(); - } while (up1 != up2); - s = ((ulong)up << 32) | lo; -#endif - return s; -} - -static ulong ns_to_tb(ulong ns) -{ - return (ns * timebase_freq) / 1000000000ULL; -} - -static ulong tb_to_ns(ulong tb) -{ - return tb * (1000000000ULL / timebase_freq); -} - -/* - * Return nanoseconds from time of boot - */ s_time_t get_s_time(void) { return tb_to_ns(get_timebase()); diff --git a/xen/include/asm-powerpc/time.h b/xen/include/asm-powerpc/time.h index d0692230a5..3ec8e0ba64 100644 --- a/xen/include/asm-powerpc/time.h +++ b/xen/include/asm-powerpc/time.h @@ -13,15 +13,19 @@ * along with this program; if not, write to the Free Software * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (C) IBM Corp. 2005 + * Copyright (C) IBM Corp. 2005, 2006 * * Authors: Hollis Blanchard + * Hollis Blanchard */ #ifndef _ASM_TIME_H_ #define _ASM_TIME_H_ #include +#include +#include +#include extern unsigned int timebase_freq; #define CLOCK_TICK_RATE timebase_freq @@ -29,7 +33,26 @@ extern unsigned int timebase_freq; #define watchdog_disable() ((void)0) #define watchdog_enable() ((void)0) -extern u64 get_timebase(void); +static inline u64 get_timebase(void) +{ + u64 s; + +#ifdef __PPC64__ + s = mftb(); +#else + do { + unsigned up; + unsigned lo; + unsigned up2; + + up = mftbu(); + lo = mftbl(); + up2 = mftbu(); + } while (up1 != up2); + s = ((ulong)up << 32) | lo; +#endif + return s; +} typedef u64 cycles_t; static inline cycles_t get_cycles(void) @@ -39,4 +62,15 @@ static inline cycles_t get_cycles(void) return c; } +#define __nano(s) ((s) * 1000000000ULL) + +static inline u64 ns_to_tb(u64 ns) +{ + return (ns * timebase_freq) / __nano(1); +} + +static inline u64 tb_to_ns(u64 tb) +{ + return tb * (__nano(1) / timebase_freq); +} #endif